package cn.edu.gzist.chapter03.controller;

import jakarta.servlet.http.PushBuilder;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

@RestController
public class UploadController {
    @PostMapping("upload")
    public String upload(@RequestParam("file") MultipartFile myfile) throws IOException {

        myfile.transferTo(new File("f://config.ini"));
         return "success";
    }
}
